import React, {useEffect, useState} from 'react';
import {useParams} from "react-router-dom";
import axios from "axios";

function Detail(props) {
    const {id} =useParams();
    const [info,setInfo] = useState({});
    useEffect(()=>{
        axios.get("/info/"+id).then(value=>{
            setInfo(value.data);
        })
    },[])
    return (
        <div>
            <h3>{info.title}</h3>
            <p>{info.content}</p>
        </div>
    );
}

export default Detail;